#pragma once

extern "C" {
#include <libavformat/avformat.h>
#include <libavcodec/avcodec.h>
#include <libavutil/imgutils.h>
#include <libavutil/timestamp.h>
// #include <libswscale/swscale.h>

#include "hb_comm_venc.h"
#include "hb_comm_vdec.h"
#include "hb_venc.h"
#include "hb_vdec.h"
#include "hb_vio_interface.h"
#include "hb_sys.h"
#include "ion.h"
}

#include "camera/hikbase.h"
#include "stream/total_struct.h"
#include "stream/base_puller.h"
#include "stream/horizon/base_osd.h"


namespace stream {


#define SET_BYTE(_p, _b) \
    *_p++ = (unsigned char)_b;

#define SET_BUFFER(_p, _buf, _len) \
    memcpy(_p, _buf, _len); \
    (_p) += (_len);

#define CLEAR(x) memset(&(x), 0, sizeof(x))

class HBStreamPullerBase: public BasePuller
{
public:
  HBStreamPullerBase(StreamPullerInfo* sifo, LogInfo* log_info);
  virtual ~HBStreamPullerBase();

public:
  static int global_init();
  static int global_release();

  virtual int init_params() = 0;
  virtual int start_pull() = 0;
  int stop_pull();

  virtual int get_frame(stream::ImageBlob& buffer) = 0;

public: 
  int sample_vdec_ChnAttr_init(VDEC_CHN_ATTR_S *pVdecChnAttr);

  std::mutex queue_lock;
  std::queue<stream::ImageBlob> queue_data;

};


}   // namespace camera
